Skip to content

feat: implement article details page with related articles#1349

Merged
SB2318 merged 2 commits into
SB2318:webfrom
Shanidhya01:feature/article-details-page
Jun 12, 2026
Merged

feat: implement article details page with related articles#1349
SB2318 merged 2 commits into
SB2318:webfrom
Shanidhya01:feature/article-details-page

Conversation

@Shanidhya01

Copy link
Copy Markdown

PR Description

Implements a production-ready Health Articles feature for the UltimateHealth web platform — a full article detail reading experience and an articles index/listing page, wired into the existing site navigation.

Closes #1015

Changes include:

  • src/types/article.ts — TypeScript types for Article, RichContent, and all ContentBlock subtypes (paragraph, heading, callout, list, image, code, divider)
  • src/lib/article-data.ts — 5 mock articles with full metadata, getArticleById(), getRelatedArticles() helpers, and 10 default glossary terms
  • src/app/articles/page.tsx — Articles index page at /articles with a 3-column responsive card grid
  • src/app/articles/[id]/page.tsx — Dynamic article detail page with generateMetadata(), generateStaticParams(), and notFound() support
  • src/components/articles/GlossaryProvider.tsx — React context distributing medical glossary terms
  • src/components/articles/ReadingProgressBar.tsx — Fixed scroll-progress bar with ARIA progressbar role
  • src/components/articles/AccessibilityControls.tsx — Floating font-size panel (sm/md/lg) with TTS/bookmark stubs
  • src/components/articles/ArticleBreadcrumbs.tsx — Structured breadcrumb trail using existing Breadcrumb UI
  • src/components/articles/ArticleHero.tsx — Hero with Next.js Image, category badge, H1, tags
  • src/components/articles/ArticleContent.tsx — Rich content renderer with inline glossary tooltip highlighting
  • src/components/articles/RelatedArticles.tsx — Scored related-article suggestions in a responsive grid
  • src/components/articles/ArticlePageClient.tsx — Single client boundary composing the full reading page
  • src/app/page.tsx — Desktop nav, mobile nav, and footer Quick Links updated to link to /articles

Type of Change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update

Select your work-area

  • Frontend
  • Backend
  • Documentation
  • Others

Related Issue

Please provide a link to the issue solved if applicable.

Screenshot

image

Fixes (mention the issue number which this fixes)

#closes

Checklist

  • I have updated my branch and synced it with the project's 'develop' branch before making this PR.
  • I have optimized the file changes.
  • I have added a snapshot of my work example.
  • I have made a PR to the project's develop branch.

Undertaking

  • My code follows the style guidelines of this project.

  • I have performed a self-review of my code.

  • I have commented my code, particularly in hard-to-understand areas.

  • I have made corresponding changes to the documentation.

  • I have checked for plagiarism and assure its authenticity.

  • I have read and followed the code of conduct for this repository. I understand that violation of this undertaking may have legal consequences.

  • I Agree

@github-actions

Copy link
Copy Markdown
Contributor

Thank you @, for creating the PR and contributing to our UltimateHealth project 💗.
Our team will review the PR and will reach out to you soon! 😇
Make sure that you have marked all the tasks that you are done with ✅.
Thank you for your patience! 😀

@github-actions

Copy link
Copy Markdown
Contributor

Automated Review Feedback

Provide actionable comments grouped by severity:

Critical

The use of dangerouslySetInnerHTML in web/src/components/articles/ArticleContent.tsx for paragraph blocks is a significant security risk (Cross-Site Scripting - XSS) if the block.html content is not guaranteed to be sanitized and controlled. While the PR description states "data is controlled," this assumption needs to be explicitly documented in the code. Please add a comment next to the dangerouslySetInnerHTML usage stating that the block.html content is assumed to be pre-sanitized and should never come directly from untrusted user input without server-side sanitization.

Important

  1. Missing Tests: This pull request introduces a substantial new feature with complex rendering logic and data handling. There are no accompanying unit or integration tests. Adding tests for data fetching/processing (web/src/lib/article-data.ts), content rendering (web/src/components/articles/ArticleContent.tsx), and interactive components (web/src/components/articles/AccessibilityControls.tsx, web/src/components/articles/GlossaryProvider.tsx) would significantly improve the robustness and maintainability of the feature.
  2. Type Correctness: In web/src/app/articles/[id]/page.tsx, the PageProps interface defines params as Promise<{ id: string }>. In Next.js App Router, params is directly an object { id: string }, not a Promise. Please update the type definition to params: { id: string }.

Suggestions

  1. Accessibility: ReadingProgressBar aria-valuetext: For the ReadingProgressBar in web/src/components/articles/ReadingProgressBar.tsx, consider adding an aria-valuetext attribute. This would provide a more descriptive announcement for screen reader users, such as aria-valuetext={${Math.round(progress)}% of article read}, enhancing the user experience for assistive technologies.
  2. Performance: Glossary Highlighting Regex (Future consideration): In web/src/components/articles/ArticleContent.tsx, the applyGlossaryHighlighting function constructs a new regular expression and performs a split operation on every render for each paragraph. While acceptable for the current small glossary and typical paragraph lengths, if the glossary grows very large or articles become extremely long, this could become a performance bottleneck. For future scalability, consider pre-compiling the regex or exploring more optimized text processing strategies if performance issues arise.

Maintainer Note:

Once the initial automated feedback has been addressed, maintainer @SB2318 will review the pull request for final evaluation.

@SB2318

SB2318 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

@Shanidhya01 Try to go with some test data and solved bot points, no need to write a unittest.

@SB2318 SB2318 merged commit 90d1e5f into SB2318:web Jun 12, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Congratulations, Your pull request has been successfully merged 🥳🎉 Thank you for your contribution to the project 🚀 Keep Contributing!! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants